//加载view目录下的所有组件
const modus = import.meta.glob('../views/*/*.vue')

export const loadComponent = (componentName: string) => {
  //开发阶段，下面懒加载写法没问题;生产阶段会报错
  // return ()=>import(`../views/${componentName}`)

  //生产阶段
  const fullComponentPath = `../views/${componentName}`
  const dynamicComponent = modus[fullComponentPath]
  return dynamicComponent
}
